package babo.cd.physicalexperiment.activity;

import android.content.SharedPreferences;
import android.view.View;

import babo.cd.physicalexperiment.BaseActivity;
import babo.cd.physicalexperiment.app.MyApplication;
import babo.cd.physicalexperiment.data.UserInfo;
import babo.cd.physicalexperiment.databinding.ActivitySettingBinding;

public class SettingActivity extends BaseActivity {
    ActivitySettingBinding binding;


    @Override
    protected View bindView() {
        binding=ActivitySettingBinding.inflate(getLayoutInflater());
        return binding.getRoot();
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void loadData() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

    }

    @Override
    public void setListener() {
        super.setListener();
        binding.changepsw.setOnClickListener(view -> {
            goToNextActivity(UpdatePasswordActivity.class);
        });
        binding.txExit.setOnClickListener(view -> {
            SharedPreferences.Editor editor=sharedPreferences.edit();
            editor.putString("uid","");
            editor.putString("token","");
            editor.putString("psw","");
            editor.commit();
            MyApplication.getInstance().setUserBaseInfo(null);
            UserInfo.JsessionId="";
            UserInfo.userId="";

            goToNextActivity(LoginActivity.class);
        });
    }
}
